-
-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Virtual envirnoment data dir issues when using local directory #1022
Conversation
Hey @ofek, would be great if this one makes it to upcoming release. |
Yes it will be thank you!
I want those to always be isolated |
Yeah they will be isolated, it's just that
In current
which seems to be slightly confusing? If it's intentional, I'm happy to remove this part from PR. |
Yes actually I don't want build environments anywhere else but that internal hidden location away from sight |
Sounds good, I reverted original behavior for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
* fixing virtual env directories * black * checking isolated_data_directory * checking isolated_data_directory * signed commit * fast path * add release note * spacing --------- Co-authored-by: Ofek Lev <[email protected]> 0326e47
Hey guys! I believe there are few issues with how VirtualEnvironment manages directories.
Everything works fine until you try to set
HATCH_DATA_DIR=/root_project/.hatch/data
- i.e. to something inside the project.VirtualEnvironment.__init__()
checks if data_directory is inside root_directory and based on that either uses "flat structure" or adds achecksum
-level of directories.:But since
self.data_directory
is not.resolved()
it can either be absolute or relative path (both being inside self.root) - based on thatif
produces different results:HATCH_DATA_DIR=/root_project/.hatch/data
- will get a "flat structure" whileHATCH_DATA_DIR=.hatch/data
- will get a directory withchecksum
.While
[env]-build
environment will always go tochecksum
directory no matter what.This behavior brings two issues:
HATCH_DATA_DIR=/root_project/.hatch/data
regular env ends up being in "flat-structure", while-build
env goes to "checksum-structure". If user runshatch build
first, it will create env under:root/.hatch/virtual/my-project/jeh852/my-project-build
. Then user runshatch run format
and hatch will fail, since it will check fordefault
env under flat structure:root/.hatch/virtual/my-project/
- dir does exist, but there is no env there => hatch will crash on the next step.HATCH_DATA_DIR=.hatch/data
(relative path) - the flat structure is completely ignored, which doesn't cause errors, but ignores scenario described here.nit: when user setsenvs.default.path=
property only regular environment is created under that path. I guess-build
one also should be placed there, right? It's a resource of the same Environment.TL/DR: proposing PR to properly handle "flat structure", when
HATCH_DATA_DIR
is inside root of the project.